﻿using System.Collections.Generic;
using System.Linq;

namespace Tuxedo.Compile
{
	internal class FunctionCall : Expression
	{
		private Expression root;
		private Expression[] parameters;
		public bool[] IsOut { get; private set; }
		public bool[] IsRef { get; private set; }
		public UnverifiedType[] Types { get; private set; }

		private static readonly UnverifiedType[] EMPTY_TYPE_LIST = new UnverifiedType[0];

		public FunctionCall(Expression root, IList<UnverifiedType> types, IList<Expression> parameters, IList<string> outOrRef)
		{
			this.root = root;
			this.parameters = parameters.ToArray();
			this.IsOut = outOrRef.Select<string, bool>(str => str == "out").ToArray();
			this.IsRef = outOrRef.Select<string, bool>(str => str == "ref").ToArray();
			this.Types = types == null ? EMPTY_TYPE_LIST : types.ToArray();
		}
	}
}
